﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace GroupMeal.Migrations
{
    /// <inheritdoc />
    public partial class MemnerGroupEdit : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MemberGroup_Groups_GroupId1",
                table: "MemberGroup");

            migrationBuilder.DropForeignKey(
                name: "FK_MemberGroup_Members_MemberId1",
                table: "MemberGroup");

            migrationBuilder.DropIndex(
                name: "IX_MemberGroup_GroupId1",
                table: "MemberGroup");

            migrationBuilder.DropIndex(
                name: "IX_MemberGroup_MemberId1",
                table: "MemberGroup");

            migrationBuilder.DropColumn(
                name: "GroupId1",
                table: "MemberGroup");

            migrationBuilder.DropColumn(
                name: "MemberId1",
                table: "MemberGroup");

            migrationBuilder.DropColumn(
                name: "AccessToken",
                table: "AbpTenants");

            migrationBuilder.DropColumn(
                name: "AppId",
                table: "AbpTenants");

            migrationBuilder.DropColumn(
                name: "AppSecret",
                table: "AbpTenants");

            migrationBuilder.DropColumn(
                name: "ExpirationTime",
                table: "AbpTenants");

            migrationBuilder.DropColumn(
                name: "StableAccesssToken",
                table: "AbpTenants");

            migrationBuilder.DropColumn(
                name: "StableExpirationTime",
                table: "AbpTenants");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "GroupId1",
                table: "MemberGroup",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<Guid>(
                name: "MemberId1",
                table: "MemberGroup",
                type: "uniqueidentifier",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));

            migrationBuilder.AddColumn<string>(
                name: "AccessToken",
                table: "AbpTenants",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "AppId",
                table: "AbpTenants",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "AppSecret",
                table: "AbpTenants",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "ExpirationTime",
                table: "AbpTenants",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<string>(
                name: "StableAccesssToken",
                table: "AbpTenants",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "StableExpirationTime",
                table: "AbpTenants",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.CreateIndex(
                name: "IX_MemberGroup_GroupId1",
                table: "MemberGroup",
                column: "GroupId1");

            migrationBuilder.CreateIndex(
                name: "IX_MemberGroup_MemberId1",
                table: "MemberGroup",
                column: "MemberId1");

            migrationBuilder.AddForeignKey(
                name: "FK_MemberGroup_Groups_GroupId1",
                table: "MemberGroup",
                column: "GroupId1",
                principalTable: "Groups",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MemberGroup_Members_MemberId1",
                table: "MemberGroup",
                column: "MemberId1",
                principalTable: "Members",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
